package com.yanmaohu.yulia.statement;

import com.yanmaohu.yulia.bean.LocalOrSchemaQualifiedName;
import com.yanmaohu.yulia.bean.QueryExpression;
import com.yanmaohu.yulia.bean.SchemaElement;
import com.yanmaohu.yulia.bean.ViewSpecification;

/**
 * @author Bright Lee
 */
public final class ViewDefinition implements SchemaElement, SqlSchemaDefinitionStatement, Statement {

    private int beginIndex;
    private int endIndex;
    private boolean recursive;
    private LocalOrSchemaQualifiedName tableName;
    private ViewSpecification viewSpecification;
    private QueryExpression queryExpression;
    private boolean withCascadedCheckOption;
    private boolean withLocalCheckOption;
    private boolean withCheckOption;

    public ViewDefinition(int beginIndex,
                          int endIndex,
                          boolean recursive,
                          LocalOrSchemaQualifiedName tableName,
                          ViewSpecification viewSpecification,
                          QueryExpression queryExpression,
                          boolean withCascadedCheckOption,
                          boolean withLocalCheckOption,
                          boolean withCheckOption) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.recursive = recursive;
        this.tableName = tableName;
        this.viewSpecification = viewSpecification;
        this.queryExpression = queryExpression;
        this.withCascadedCheckOption = withCascadedCheckOption;
        this.withLocalCheckOption = withLocalCheckOption;
        this.withCheckOption = withCheckOption;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public boolean isRecursive() {
        return recursive;
    }

    public LocalOrSchemaQualifiedName getTableName() {
        return tableName;
    }

    public ViewSpecification getViewSpecification() {
        return viewSpecification;
    }

    public QueryExpression getQueryExpression() {
        return queryExpression;
    }

    public boolean isWithCascadedCheckOption() {
        return withCascadedCheckOption;
    }

    public boolean isWithLocalCheckOption() {
        return withLocalCheckOption;
    }

    public boolean isWithCheckOption() {
        return withCheckOption;
    }

}
